package com.huawei.hms.auth.api.signin.internal;

import org.json.JSONException;
import org.json.JSONObject;

public class a {
    private String a;
    private String b;
    private long c;
    private String d;

    public void a(String str) {
        this.a = str;
    }

    public void b(String str) {
        this.b = str;
    }

    public void a(long j) {
        this.c = j;
    }

    public String a() {
        return this.d;
    }

    public void c(String str) {
        this.d = str;
    }

    public String b() throws JSONException {
        return c().toString();
    }

    protected JSONObject c() throws JSONException {
        JSONObject jSONObject = new JSONObject();
        jSONObject.putOpt("appId", this.a);
        jSONObject.putOpt("packageName", this.b);
        jSONObject.put("hmsSdkVersion", this.c);
        jSONObject.putOpt("subAppId", this.d);
        return jSONObject;
    }

    public static a d(String str) throws JSONException {
        return new a().a(new JSONObject(str));
    }

    protected a a(JSONObject jSONObject) {
        this.a = jSONObject.optString("appId", null);
        this.b = jSONObject.optString("packageName", null);
        this.c = jSONObject.optLong("hmsSdkVersion");
        this.d = jSONObject.optString("subAppId", null);
        return this;
    }

    public String toString() {
        return "HuaweiIdCpClientInfo{appId='" + this.a + '\'' + ", packageName='" + this.b + '\'' + ", hmsSdkVersion=" + this.c + '\'' + ", subAppId=" + this.d + '}';
    }
}
